#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <Qt>
#include <QAbstractItemView>
#include <QAction>
#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QFileInfoList>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QImage>
#include <QLabel>
#include <QMainWindow>
#include <QMessageBox>
#include <QPixmap>
#include <QPushButton>
#include <QRegularExpression>
#include <QStackedWidget>
#include <QStatusBar>
#include <QTextCursor>
#include <QTextEdit>
#include <QTextStream>
#include <QTextBrowser>
#include <QToolBar>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
#include <QVBoxLayout>
#include <QtWebEngineWidgets/QWebEngineView>
#include <QtWebEngineWidgets/QWebEngineSettings>
#include <Qsci/qsciscintilla.h>

#include <yaml-cpp/yaml.h>

#include "auxiliary_function.h"
#include "custom_qdialog.h"
#include "custom_qlabel.h"
#include "imagewindow.h"
#include "oss_sdk.h"
#include "qiniu_sdk.h"
#include "transferwindow.h"

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow();
    ~MainWindow();

private:
    QWebEngineView *gWebView;
    QTextEdit *gMarkdownEdit;
    QsciScintilla *gCodeEdit;
    QTreeWidget *gFileTree;
    QTreeWidget *gDBTree;
    QStackedWidget *gStackWin;
    ClickedQLabel *gArrowLabel;
    QString gCurrentLoadFile;
    QString gAbsolutePath;
    QStringList gAccessKey;
    bool isViewMode;
    bool isLoadMDFile;

    CustomDialog *selectDialog;
    TransferWindow *transferWindow;
    ImageWindow *imageWindow;

    void CreateMainWindow();
    void SetWidgets();
    void CreateToolBar();
    void RemoveFileTreeItems(QTreeWidget *);
    void RemoveDBTreeItems(QTreeWidget *);
    void MarkDown2HTML(const QString &);
    void EditMarkDown(const QString &);
    void ReadYAMLFile();

protected:

private slots:
    void SlotOpenFile();
    void SlotOpenFolder();
    void SlotArrowClicked();
    void SlotTextEditCursorPositionChanged();
    void SlotTextEditContentChanged();
    void SlotLogin();
    void SlotConfigBackend();
    void SlotUploadFile();
    void SlotDownloadFile();
    void SlotCloudDB();
    void SlotTransfer();
    void SlotHelp();
    void SlotForkProject();
    void SlotPay();
    void SlotFileTreeItemClicked();
};

#endif // MAINWINDOW_H
